package com.hgyc.mom.qms.controller;

import java.util.*;
import jakarta.servlet.http.HttpServletResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.BeanUtils;
import org.springframework.web.multipart.MultipartFile;
import com.hgyc.mom.qms.entity.QmsTemplateIndex;
import com.hgyc.mom.qms.service.QmsTemplateIndexService;
import com.hgyc.mom.common.vo.Result;
import com.hgyc.mom.common.util.poi.ExcelUtil;

import com.hgyc.mom.core.mybatis.QueryWrapperUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * 检测模板-检测项Controller
 *
 * @author fwj
 * @since 2025-09-26
 */
@Tag(name = "检测模板-检测项控制器", description = "检测模板-检测项控制器")
@RestController
@RequestMapping("/qms/template/index")
public class QmsTemplateIndexController {
    @Autowired
    private QmsTemplateIndexService qmsTemplateIndexService;


    @Operation(summary = "查询检测模板-检测项树列表", description = "查询检测模板-检测项树列表")
    @PostMapping("/list")
    public Result<List<QmsTemplateIndex>> pageList(@Parameter(description = "查询参数") @RequestBody QmsTemplateIndex qmsTemplateIndex) {
        QueryWrapper<QmsTemplateIndex> wrapper = QueryWrapperUtil.build(qmsTemplateIndex);
        List<QmsTemplateIndex> list = qmsTemplateIndexService.list(wrapper);
        return Result.success(list);
    }

    @Operation(summary = "获取检测模板-检测项详细信息", description = "获取检测模板-检测项详细信息")
    @GetMapping(value = "/{id}")
    public Result<QmsTemplateIndex> getInfo(@Parameter(description = "检测模板-检测项ID") @PathVariable("id") Long id) {
        return Result.success(qmsTemplateIndexService.getById(id));
    }

}
